﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;

namespace Kira.Compiler.Bods
{
    [XmlElementMapping("DIElement")]
    public class DIElement : BodsElementBase
    {

        public String Name
        {
            get { return this.GetAttrbuteValue("name"); }
        }

        public BodsDataType DataType
        {
            get
            {
                return (BodsDataType)Enum.Parse(typeof(BodsDataType), this.GetAttrbuteValue("datatype"), true);
            }
        }

        public bool HasSize
        {
            get
            {
                return this.HasAttribute("size");
            }
        }

        public int Size
        {
            get
            {
                return int.Parse(this.GetAttrbuteValue("size"));
            }
        }

        public bool HasPrecision
        {
            get
            {
                return this.HasAttribute("precision");
            }
        }

        public int Precision
        {
            get
            {
                return int.Parse(this.GetAttrbuteValue("precision"));
            }
        }

        public bool HasScale
        {
            get
            {
                return this.HasAttribute("scale");
            }
        }
        public int Scale
        {
            get
            {
                return int.Parse(this.GetAttrbuteValue("scale"));
            }
        }
        public ParameterType ParameterType
        {
            get
            {
                return (ParameterType)Enum.Parse(typeof(ParameterType), this.GetAttrbuteValue("paramType"), true);
            }
        }

    }

    public enum ParameterType
    {
        Local, In, Out, Global
    }
}
